<?
	require_once "../../_func/__Global.php";
	require_once "../../_func/__Local.php";
	require_once "../../_func/__MysqlFunc.php";
	require_once "../../_func/_CodeFunc.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>:: do ::</title>
</head>
<body>
<!-- header start -->
<? include("../_layout/head.inc"); ?>
<!-- header end -->
<?
	$seq = $param->getString('seq');
	$mode = $param->getString('mode');
	$order_date = $param->getString('order_date');
	$jbnh_seq = $param->getNumber('jbnh_seq');
	$order_type = $param->getNumber('order_type');
	$order_item1 = $param->getNumber('order_item1');
	$order_item2 = $param->getNumber('order_item2');
	$order_grade1 = $param->getNumber('order_grade1');
	$order_grade2 = $param->getNumber('order_grade2');
	$order_standard1 = $param->getNumber('order_standard1');
	$order_standard2 = $param->getNumber('order_standard2');
	$order_weight1 = $param->getNumber('order_weight1');
	$order_weight2 = $param->getNumber('order_weight2');
	$order_number = $param->getNumber('order_number');
	$order_destination1 = $param->getNumber('order_destination1');
	$order_destination2 = $param->getNumber('order_destination2');
	$order_arrivaldate = $param->getString('order_arrivaldate');
	$order_arrivaltime = $param->getString('order_arrivaltime');
	$order_total = $param->getNumber('order_total');

	if ($mode == "w")
	{
		if ($order_date=="" || $jbnh_seq=="" || $order_type=="" || $order_item1=="" || $order_item2=="" || $order_grade1=="" || $order_grade2=="" || $order_standard1=="" || $order_standard2=="" || $order_weight1=="" || $order_weight2=="" || $order_number=="" || $order_destination1=="" || $order_destination2=="" || $order_arrivaldate=="" || $order_arrivaltime=="" || $order_total=="")
		{
			jserror("입력값을 확인해주세요.","document.location='about:blank'");
			return;
		}
		$article_arr = array(
			'JBNH_SEQ' => $jbnh_seq,
			'ORDER_TYPE' => $order_type,
			'ORDER_ITEM1' => $order_item1,
			'ORDER_ITEM2' => $order_item2,
			'ORDER_GRADE1' => $order_grade1,
			'ORDER_GRADE2' => $order_grade2,
			'ORDER_STANDARD1' => $order_standard1,
			'ORDER_STANDARD2' => $order_standard2,
			'ORDER_WEIGHT1' => $order_weight1,
			'ORDER_WEIGHT2' => $order_weight2,
			'ORDER_NUMBER' => $order_number,
			'ORDER_TOTAL' => $order_total,
			'ORDER_DESTINATION1' => $order_destination1,
			'ORDER_DESTINATION2' => $order_destination2,
			'ORDER_ARRIVALDATE' => $order_arrivaldate,
			'ORDER_ARRIVALTIME' => $order_arrivaltime,
			'ORDER_DATE' => $order_date,
		);

		$no = Order_InsertArticle($article_arr);

		if ($no == -1)
		{
			jserror("등록중 오류가 발생했습니다.","document.location='about:blank'");
			return;
		}
		else
		{
			cacheControl(0);
			// 출력 버퍼를 비운다.
			ob_clean();
			jserror("등록되었습니다.","parent.location.reload()");
		}
	}
	else if ($mode == "u")
	{
		if ($order_date=="" || $jbnh_seq=="" || $order_type=="" || $order_item1=="" || $order_item2=="" || $order_grade1=="" || $order_grade2=="" || $order_standard1=="" || $order_standard2=="" || $order_weight1=="" || $order_weight2=="" || $order_number=="" || $order_destination1=="" || $order_destination2=="" || $order_arrivaldate=="" || $order_arrivaltime=="" || $order_total=="" || $seq=="")
		{
			jserror("입력값을 확인해주세요.","document.location='about:blank'");
			return;
		}
		$article_arr = array(
			'JBNH_SEQ' => $jbnh_seq,
			'ORDER_TYPE' => $order_type,
			'ORDER_ITEM1' => $order_item1,
			'ORDER_ITEM2' => $order_item2,
			'ORDER_GRADE1' => $order_grade1,
			'ORDER_GRADE2' => $order_grade2,
			'ORDER_STANDARD1' => $order_standard1,
			'ORDER_STANDARD2' => $order_standard2,
			'ORDER_WEIGHT1' => $order_weight1,
			'ORDER_WEIGHT2' => $order_weight2,
			'ORDER_NUMBER' => $order_number,
			'ORDER_TOTAL' => $order_total,
			'ORDER_DESTINATION1' => $order_destination1,
			'ORDER_DESTINATION2' => $order_destination2,
			'ORDER_ARRIVALDATE' => $order_arrivaldate,
			'ORDER_ARRIVALTIME' => $order_arrivaltime,
			'ORDER_DATE' => $order_date,
		);
		$no = Order_UpdateArticle($article_arr, $seq);
		if ($no == -1)
		{
			jserror("수정중 오류가 발생했습니다.","document.location='about:blank'");
			return;
		}
		else
		{
			cacheControl(0);
			// 출력 버퍼를 비운다.
			ob_clean();
			jserror("수정되었습니다.","parent.fnlist()");
		}
	}
	else if ($mode == "d")
	{
		if ($seq=="")
		{
			jserror("입력값을 확인해주세요.","document.location='about:blank'");
			return;
		}
		$no = Order_DeleteArticle($seq);
		if ($no == -1)
		{
			jserror("삭제중 오류가 발생했습니다.","document.location='about:blank'");
			return;
		}
		else
		{
			cacheControl(0);
			// 출력 버퍼를 비운다.
			ob_clean();
			jserror("삭제되었습니다.","parent.fnlist()");
		}
	}
?>
</body>
</html>